import { oneNet } from "@/utils"
// 生成电感式传感器
export const GenerateProductService = (data: any) => {
  return oneNet.post({
    url: "/product?type="+data.Type,
    data
  })
}

export const FindProductService = (data: any) => {
  let path = ""
  Object.keys(data).forEach((item) => {
    console.log("key  ", item)
    if(path == "" && data[item] != "") {
      path = `${item}=${data[item]}`
    } else if (data[item] != "" && path != "") {
      path += `&${item}=${data[item]}`
    }
  })
  return oneNet.get({
    url: `/product?${path}`
  })
}

export const UpdateProductService = (data: any) => {
  return oneNet.put({
    url: "/product?type="+ data.Type,
    data
  })
}

export const DeleteProductService = (data: any) => {
  return oneNet.delete({
    url: "/product?type="+ data.Type,
    data
  })
}
